#define CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>

int* chuanlian(char* arr, size_t size)
{
	int* p = malloc(2*size);
	if (p == NULL)
	{
		return NULL;
	}
	int i = 0, j = 0;
	for (i = 0; i < 2; i++)
	{
		for (j = 0; j < size; j++)
		{
			p[i * size + j] = arr[j];
		}
	}
	return p;
}

int main()
{
	int arr[10] = { 0,1,2,3,4,5,6,7,8,9 };
	int i = 0;
	for (i = 0; i < 10; i++)
	{
		fprintf(stdout, "%d ",arr[i]);
	}
	fprintf(stdout, "\n");
	int* p = chuanlian(arr, 10);
	if (p == NULL)
	{
		perror("chuanlian_malloc");
		return EXIT_FAILURE;
	}
	for (i = 0; i < 20; i++)
	{
		fprintf(stdout, "%d ", p[i]);
	}
	fprintf(stdout, "\n");
	free(p);
	p = NULL;
	return 0;
}